package com.example.Intercepor;


import javax.servlet.http.HttpServletRequest;
import javax.servlet.http.HttpServletResponse;



import org.springframework.web.servlet.handler.HandlerInterceptorAdapter;

import com.example.util.HttpUtil;



public class LoginInterceptor extends HandlerInterceptorAdapter {
	@Override
	public boolean preHandle(HttpServletRequest request, HttpServletResponse response, Object handler) throws Exception {
//		String user = request.getHeader("userName");
//		String userId = request.getHeader("userId");
//		String token = request.getHeader("token");
//		if(request.getRequestURI().contains("login")){
//			return true;
//		}
//		Element e = ehcache.get(userId);
//		if (e!=null&&token.equals(e.getObjectValue())) {
		System.out.println(2222);
		System.out.println(HttpUtil.getVisitorIp(request));
		return true;
//		}
//		return false;
	}

}
	